﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Portal.Workflow.Model;
using System.Data.SqlClient;
using Portal.Core;
using Portal.Web.Utility;
using Portal.Cms.Bussiness;
using Portal.Cms.Utility;
using Portal.Cms.Model;
using System.Data;

namespace Portal.Cms.WorkflowFunctions
{
    public class WorkflowFunctionUnPublicData : WorkFlowFunctionTemplate
    {
        public override string WfFunctionId
        {
            get
            {
                return "WorkflowFunctionUnPublicData";
            }
        }

        public override string Name
        {
            get
            {
                return "Dỡ phát hành";
            }
        }

        public override bool RunAtServer
        {
            get
            {
                return true;
            }
        }

        public override RetWfExecuteParamCls Execute(WfExecuteParamCls oWfExecuteParamCls)
        {
            RetWfExecuteParamCls oRetWfExecuteParamCls = new RetWfExecuteParamCls();
            //SiteParam OSiteParam = WebEnvironments.CreateSiteParam(oWfExecuteParamCls.SiteId);
            string SiteId=oWfExecuteParamCls.SiteId;
            string WorkflowDefId=oWfExecuteParamCls.WorkflowDefId;
            string WorkflowActionId=oWfExecuteParamCls.WorkflowActionId;
            string RecordId = oWfExecuteParamCls.RecordId;
            CmsUtility.CreateCmsBussinessProcess(SiteId).CreateCmsProcess(SiteId).UnPublicData((IDbTransaction) oWfExecuteParamCls.SqlTransaction, SiteId, RecordId);
            //sharepoint nua....!
            return oRetWfExecuteParamCls;
        }
    }
}
